package com.zhouwr.common.metadata;

import com.alibaba.fastjson.JSON;
import com.zhouwr.common.enums.ModelDataType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @program: forallcn-iotps
 * @description:
 * @author: zhouwr
 * @create: 2021-01-28 22:46
 * @version：1.0
 **/
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BoolData extends Metadata<Boolean>{

    private String trueText;
    private String falseText;


    private Boolean defaultValue = false;
    private ModelDataType type = ModelDataType.BOOL;

    @Override
    public Boolean getDefaultValue() {
        return this.defaultValue;
    }

    @Override
    public ModelDataType getType() {
        return this.type;
    }
    public static Metadata<?> form(String metadata) {
        return JSON.toJavaObject(JSON.parseObject(metadata), BoolData.class);
    }

}
